// pages/head/head.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    delivery: {
      type: String//类型
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    data1: [
      {tit: "首页", url: '../index/index'},
      {tit: "新手入门", url: ''},
      {tit: "API", url: ''},
      {tit: "关于", url: ''},
      {tit: "注册", url: ''},
      {tit: "登录", url: '../register/register'}
    ],
    data2: [
      {tit: "首页", url: '../index/index'},
      {tit: "未读消息", url: ''},
      {tit: "新手入门", url: ''},
      {tit: "API", url: ''},
      {tit: "关于", url: ''},
      {tit: "设置", url: ''},
      {tit: "退出", url: '../index/index'}
    ],
    boo: '',
    abc: '',
    // text: ''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    clear(e) {
      let text = e.currentTarget.dataset.text.tit;
      let path = e.currentTarget.dataset.text.url;
      if ("退出" == text) {
        wx.setStorage({
          key: 'boo',
          data: false,
        })
        this.setData({
          boo: false
        })
      }
      if (path){
        wx.redirectTo({
          url: path,
        })
      }
    }
  },
  attached() {
    let _this = this
    wx.getStorage({
      key: 'boo',
      success: function(res) {
        _this.setData({
          boo: res.data
        })
      },
    })

  }
})
